package com.sifeng.test;

import com.github.junrar.Archive;
import com.github.junrar.exception.RarException;

import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @ClassName CheckRar
 * @Description TODO
 * @Author yang_gsh
 * @Date 2019/7/3 14:40
 **/
public class CheckRar {
    public static void main(String[] args) throws IOException, RarException {
        File file = new File("E:\\WeChat Files\\WeChat Files\\sifengzone\\FileStorage\\File\\2019-07\\异业联名卡方案汇报0619(1).rar");
        Archive archive = new Archive(file,null);
        if(archive.getFileHeaders().size() > 0) {
            System.out.println("是RAR");
        } else {
            System.out.println("非RAR");
        }

        //System.out.println(getCreateDate());

    }

    /**
     * 获取指定类型的创建日期
     * @return
     */
    public static  String getCreateDate(){
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
        String createDate = sdf.format(new Date());
        return createDate;
    }
}
